<template>
	<div>
		<van-nav-bar
		  left-arrow
		  @click-left="onClickLeft"
		  :border="false"
		>		
		  <van-icon name="arrow-left" slot="left" color="#000" size="20"/>
		  <div slot="title" class="weight_header" style="font-size: 16px;">我的集市账户</div>
	   </van-nav-bar>
	    <div class="tips" @click="linkProgress" v-if="userInfo.checkingMoney>0">
	    	<img src="../../../../static/img/lanhu/71.png" alt="" />
	    	<span style="font-size: 14px;">{{formatMoney(userInfo.checkingMoney)}}元提现正在审核中</span>
	    </div>
	    
	    
	    <div class="container">
	        <!--<img src="../../../../static/img/lanhu/69.png" alt="" style="width: 100%;"/>-->
	        <div class="info">
	        	<div class="word1">账户余额（元）</div>
	        	<div class="word2">{{formatMoney(userInfo.myMoney)}}</div>
	        	<div class="word3">
	        		<img src="../../../../static/img/lanhu/70.png" alt="" @click="link('/market/withdrawal/bill')"/>
	        	</div>
	        	<div class="word4">在集市总共赚了{{formatMoney(userInfo.totleMoney)}}元</div>
	        	<div class="word5">（其中佣金{{formatMoney(userInfo.money)}}元)</div>
	        </div>
	    </div>
	    
	    
	    <div class="with">
	    	<span @click="showConfirm">提现</span>	 
	    </div>
	    
	    <div class="tipsWord">
	    	重要提示:
	    	<br />
	    	1.目前我们平台支付宝提现只支持以手机号创建的支付宝账号(请检查您的支付宝账号是否是以手机号码创建的) 
	    	<br />
	    	2.目前我们平台支付宝提现仅支持1个手机号码对应1个支付宝账号(如果1个手机号码下有多个支付宝账号,提现会失败)
	    </div>
	    
	    <confirm ref="confirm" @queryConfirm="queryConfirm" confirmTitle="提现协议" 
	    	subTitle="您同意根据上述协议进行提现？"
	    	title="请正确填写账号等重要信息,若由于您输入有误导致提现差错,平台不承担责任。">
	    </confirm>  
	</div>	
</template>

<script>
import confirm from '_c/market/confirm4.vue'	
import {getFun} from '@/api/publicFun.js'	
let publicFun=getFun()	
export default {	
	components: {
	    confirm
	},		
	data() {
       return {
          url1:this.$api+'/marketorderservice/api/v1/market/userCashOut/myMoneyInfo/',
          userId:'',
          userInfo:{} // 用户信息
       }
	},
	methods: {
		showConfirm(){
		    this.$refs.confirm.showWin()
		},
		// 提现协议弹框
		queryConfirm(){
			this.withdrawal()
		},
		linkProgress(){
			let arg='[{"id":"'+this.userInfo.cashId+'"}]' 
			let url=this.concatUrl('/market/withdrawal/progress',arg)
        	this.goNewWin(url)
		},
		formatMoney(str){
			if(!str&&str!=0){
				return '0.00'
			}else{
				if(str>=0){
					str=str.toFixed(2)
					return str
				}else{
					return '0.00'
				}				
			}
		},
        getData(){
          let that=this
		  this.$Axios2.Get(this.url1+this.userId).then(function(res) {
		  	that.userInfo=res.data
		  })        	
        },
        callJsGetAutonymState(){
        	let url=this.concatUrl('/market/withdrawal/mode')
        	this.goNewWin(url)
        },
        withdrawal(){
        	if(this.userInfo.myMoney==0||!this.userInfo.myMoney){
        		this.$toast('余额为0无法提现,亲,快去发售宝贝吧')
        		return false
        	}
        	// 判定是否实名认证
        	this.getRealName()
        }
	},
	mixins:[publicFun],//混入		
	mounted() {
		this.userId=this.$router.currentRoute.query.userId	
		window.callJsGetAutonymState = this.callJsGetAutonymState	
		this.getData()
	}
}	
</script>

<style scoped="" lang="scss">
*{font-size: 14px;color: #333;font-weight: 500;}
.tips{padding: 9px 15px;
   img{width: 13px;height: 13px;margin-right: 10px;}
}
.container{position: relative;background: url(../../../../static/img/lanhu/69.png)no-repeat;background-size: cover;
  .info{padding: 30px 0;text-align: center;
     .word1{font-size: 16px;margin-bottom: 20px;}
     .word2{font-size: 17px;margin-bottom: 15px;}
     .word3{margin-bottom: 23px;img{width: 80px;height: 20px;}}
     .word4{font-size: 16px;margin-bottom: 8px;}
     .word5{font-size: 12px}
  }

}
.with{margin-top: 80px;text-align: center;
   span{background: #FFD630;padding: 13px 35px;font-size: 16px;border-radius: 5px;}
}
.tipsWord{padding: 0 20px;margin-top: 50px;color: #F22613;}
</style>